<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>">

		<title>阅读邮件</title>

		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">

		<link rel="stylesheet" type="text/css" href="styles/read.css">


		<script type="text/javascript" src="js/jquery.js"></script>
		<script type="text/javascript">
			$(document).ready(function(){
				$("#reply").click(function(){
					location = "Write.action?toId=<s:property value="mail.fromUser.username"/>";
				});
				$("#delete").click(function(){
					$.ajax({
						"type":'POST',
						"url":"setSelectedDustbin.action?selectedIds="+<s:property value="mailId"/>+"&fromOrTo=<s:property value="fromOrTo"/>",
						"success":function(){	
							history.go(-1);
						}
					})
				});
			});
		</script>
	</head>

	<body>
		<table id="main">
			<tr>
				<td class="lable">
					发件人：
				</td>
				<td>
					<s:property value="mail.fromUser.nick"/>&nbsp;(<s:property value="mail.fromUser.username"/>)
				</td>
			</tr>
			<tr>
				<td class="lable">
					发件时间：
				</td>
				<td>
					<s:property value="sendTime"/>
				</td>
			</tr>
			<tr>
				<td class="lable">
					收件人：
				</td>
				<td>
					<s:property value="mail.toUser.nick"/>&nbsp;(<s:property value="mail.toUser.username"/>)
				</td>
			</tr>
			<tr>
				<td class="lable">
					收件时间：
				</td>
				<td>
					<s:property value="readTime"/>
				</td>
			</tr>
			<tr>
				<td class="lable">
					主题：
				</td>
				<td>
					<s:property value="mail.title"/>
				</td>
			</tr>
			<tr>
				<td class="lable">
					内容：
				</td>
				<td id="mail_content">
					<s:property value="mail.content" escape="false" escapeJavaScript="false"/>
				</td>
			</tr>
			<tr>
				<td class="lable">
					附件：
				</td>
				<td>
					<a href="Download.action?id=<s:property value="mail.id"/>"><s:property value="mail.attachmentName"/></a>
				</td>
			</tr>
			<tr>
				<td class="lable"></td>
				<td>
					<s:if test="%{fromOrTo=='To'}">
						<input type="button" class="btn" id="reply" value="回复" />
					</s:if>
					<input type="button" class="btn" id="delete" value="移到垃圾箱" />
				</td>
			</tr>
		</table>
	</body>
</html>
